define(function(require,exports,module){
	var ELView = require("elview");
	//ui
	var cSubnav = require("./component/roomTypeSubnav");
	var cGrid = require("./component/roomTypeGrid");
	var cForm = require("./component/roomTypeForm");
	
	var App = ELView.extend({
		attrs: {
			template: require("./assets/tpl/roomtype_main.tpl")
		},
		initComponent: function(params,widget){
			cSubnav.initComponent(widget);
			cGrid.initComponent(widget);
			cForm.initComponent(widget);
		},
		afterInitComponent: function(params,widget){
			var subnav = widget.get("subnav");
			var grid = widget.get("grid");
			var form = widget.get("form");
			grid.refresh();
		},
		toList: function(){
			this.show([".J-grid"]).hide([".J-form"]);
			this.get("subnav").show(["add","search"]).hide(["return"]);
		},
		toCard: function(){
			this.hide([".J-grid"]).show([".J-form"]);
			this.get("subnav").hide(["add","search"]).show(["return"]);
		}
	});
	
	module.exports = App;
});